<template>
  <view class="start">
    <view class="mr-commit" @click="commit" :class="sizeStatus ? 'mr-commit-big' : 'mr-commit-small'"></view> 
    <LandscapeModel v-model:show="show" :sonFun="sonFun"/>
  </view>
</template>

<script setup lang="ts">
import LandscapeModel from "@/components/Landscape/LandscapeModel.vue";
import { EnumStatus } from "@/utils/constants";
import { copywriting } from "@/utils/ab";
const sizeStatus = ref(false)
const show = ref(false)
const emit = defineEmits(['update:defStatus','update:content'])



const sonFun = async()=>{
    const data = await copywriting()
    emit('update:defStatus',EnumStatus.RESULT)
    emit('update:content',data)
}

const startTimer = () => {
    setInterval(() => {
        sizeStatus.value =  !sizeStatus.value
    }, 1000); // 每秒执行一次
  };

  const commit = async ()=>{
    uni.showLoading({
        title: "加载中",
        icon: "none",
    });
    uni.hideLoading()
    show.value = true
}

onMounted(()=>{
      startTimer()
  })
</script>

<style lang="scss" scoped>
.start{

    .mr-commit{
      z-index: 102;
      position: absolute;
      top: 86%;
      width: 60%;
      height: 100rpx;
      left: 20%;
      background-size: 100% 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      color: white;
      background-image: url("http://img-miniprogram-o.doutuimao.net/miniadmin/programconfig/xcximg/20230316/c86ca64e4712991072fd7d60bb665841.png");
  }
  .mr-commit-big{
      width: 62%;
      height: 105rpx;
      left: 19%;
      transition: all 1s;
  }
  .mr-commit-small{
      width: 60%;
      height: 100rpx;
      left: 20%;
      transition: all 1s;
  }
}

</style>
